use ::coroutine::*;

fn main() {
    coroutine::task_spwan(||{
        println!("TASK {} start", coroutine::task_id());
        for i in 1..10 {
            println!("Task {} loops {} times.", coroutine::task_id(), i);
            coroutine::task_yield();
        }
        println!("TASK {} finish", coroutine::task_id());
    });

    coroutine::task_spwan(||{
        println!("TASK {} start", coroutine::task_id());
        for i in 1..20 {
            println!("Task {} loops {} times.", coroutine::task_id(), i);
            coroutine::task_yield();
        }
        println!("TASK {} finish", coroutine::task_id());
    });

    coroutine::run();
}
